<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>市场信息表-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<!--搜索框-->
	<div class="crumbs">
		<div class="crumbs-text">市场信息表</div>
		<div class="right">
			<div class="input-group left w200">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" style="width:250px;" placeholder="按市场信息编号/名称搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
			<if condition="get_permission('CRMS-C',NULL,6) or get_permission('CRMS-C',NULL,1) or get_permission('CRMS-C',NULL,2) or get_permission('CRMS-C',NULL,3)">
			<a href="__APP__/Crm/market_add" class="btn left ml5">添加市场信息</a>
			</if>
		</div>
	</div>
	<div id="content">
		<div class="table-scrollx">
			<table class="table table-bordered table-hover" >
				<tr class="table-header fixed-table-header">
					<td width="100px">市场信息编号</td>
					<td width="300px">信息名称</td>
					<td width="100px">商务跟进项目编号</td>
					<td width="250px">
						<select name="channel" class="form-control" style="width:250px;">
							<option value="-1" <if condition="-1 eq $get_channel">selected</if>>获悉渠道</option>
							<foreach name="channel" item="co">
								<option value="{$co['id']}" <if condition="$get_channel eq $co['id']">selected</if>>{$co['name']}</option>
							</foreach>
						</select>
					</td>
					<td width="100px">推荐人</td>
					<td width="150px">推荐人联系电话</td>
					<td width="200px">管理</td>
				</tr>
				<if condition="$result eq NULL">
				<tr>
					<td colspan="7" class="text-center">暂无相关内容</td>
				</tr>
				</if>
				<foreach name="result" item="vo">
				<tr>
					<td class="nowrap"><a href="javascript:;" class="detail" mid="{$vo['information_id']}">{$vo['customer_num']}</a></td>
					<td>{$vo['customer_name']}</td>
					<td><foreach name="vo['project_info']" item="v"><a href="__APP__/CrmProject/detail/project_id/{$v['project_id']}">{$v['project_num']}</a><br></foreach></td>
					<!--<td><a href="__APP__/CrmProject/detail/project_id/{$vo['project_id']}">{$vo['project_info']['project_num']}</a></td>-->
					<td>{$vo['channel']['name']}</td>
					<td>{$vo['link_user']}</td>
					<td>{$vo['link_mobilephone']}</td>
					<td class="nowrap">
						<if condition="$vo['project_id'] eq NULL">
						<a href="__APP__/CrmProject/add/information_id/{$vo['information_id']}" data-toggle="tooltip" data-placement="left" title="跟进"><i class="glyphicon glyphicon-menu-right"></i></a>
						</if>
						<if condition="(get_permission('CRMS-C',NULL,3) and ($vo['add_uid'] eq $login_id)) or (get_permission('CRMS-C',NULL,2)) or (get_permission('CRMS-C',NULL,1)) or (get_permission('CRMS-C',NULL,7) and ($vo['add_uid'] eq $login_id))">
							<a href="__APP__/Crm/market_edit/information_id/{$vo['information_id']}" data-toggle="tooltip" data-placement="left" title="编辑" class="mr5"><i class="glyphicon glyphicon-edit"></i></a>
						</if>
						<a href="javascript:;" class="delete" action="delete" data-toggle="tooltip" data-placement="left" title="删除" mid="{$vo['information_id']}"><i class="glyphicon glyphicon-trash"></i></a>
					</td>
				</tr>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--客户详情-->
<div id="detailModal" class="modal hide fade">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4 id="myModalLabel">信息详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//搜索
	$(".found_btn").keywordSearch("__APP__/Crm/market_list/keyword/$keyword/channel/{$get_channel}");
	
	//删除
	$(".delete").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Crm/customer_information_ajax","data":{"id":"mid","action":"action"}});
	
	//跟进
	$(".follow").ajaxModal({"title_text":"确认提示框","body_text":"您确定要立刻更进该信息吗？","url":"__APP__/CrmProject/add","data":{"contact_id":"fid"}});
	
	$(document).on("change","[name='channel']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Crm/market_list/keyword/{$keyword}/channel/"+val;
	});
	
	//客户详情
	$(".detail").on("click",function(){
		var mid = $(this).attr("mid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":mid},
			url:"__APP__/Crm/market_detail",
			success:function(data){
				var html = "<table class='table table-bordered'>";
				html+="<tr><td class='side_td' width='10%'>信息名称</td><td width='40%'>";
				html+=data.customer_name ? data.customer_name : "";
				html+="</td>";
				html+="<td class='side_td' width='10%'>信息简称</td><td width='40%'>";
				html+=data.short_name ? data.short_name : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>获悉渠道</td><td colspan='3'>";
				html+=data.channel ? data.channel : "";
				html+="</td><!--<td class='side_td' width='15%'>商务对接项目编号</td><td>-->";
				/*html+=data.project_info.project_num ? data.project_info.project_num : "";*/
				html+="<!--</td>--></tr>";
				html+="<tr><td class='side_td'>推荐人</td><td>";
				html+=data.link_user ? data.link_user : "";
				html+="</td><td class='side_td' width='15%'>推荐人联系电话</td><td>";
				html+=data.link_mobilephone ? data.link_mobilephone : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>备注</td><td colspan='3'>";
				html+=data.remark ? data.remark : "";
				html+="</td></tr>";
				html+="</table>";
				$("#detailModal").find(".modal-body").html(html).end().modal();
			}
		});
	});
});
</script>
</body>
</html>